package com.laicar.geekbank;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class PhoneBookAdapter extends BaseAdapter {
    private final Context mContext;
    private LayoutInflater layoutInflater;
    private String[] names={"User1","User2"};

    public PhoneBookAdapter(Context context) {
        mContext=context;
        layoutInflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        return names.length;
    }

    @Override
    public Object getItem(int position) {
        return names[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView= layoutInflater.inflate(R.layout.item_phone_book_friend,null);
        TextView nameTextView = convertView.findViewById(R.id.name_text_view);
        nameTextView.setText(names[position]);
        return convertView;
    }
}
